#@layout()
#define main()
<div style="margin:5px 0;border-bottom:1px solid #aaa;">
	<span class="layui-breadcrumb">
		<a><cite>用户信息</cite></a>
	</span>
</div>
<div class="form_box">
	<form id="userForm" action="xpUser/editDetail" method="post" class="layui-form" enctype="multipart/form-data">
		<fieldset style="border:none;">
	<legend></legend>
	<input type="hidden" name="user.ID" value="#(user.id??)" />
	<input type="hidden" name="detail.userID" value="#(user.id??)" />
	<div >
	
		<div class="layui-form-item">
			<div class="col-12 col-sm-24">
				<div class="layui-inline col-24 col-sm-24" style="margin-bottom: 15px;">
					<label class="layui-form-label col-6 col-sm-6">上次登录时间</label>
					<!-- <label class="layui-form-label col-18 col-sm-16" style="text-align: left;">#(user.lastlogintime)</label> -->
					<div class="layui-input-inline col-18 col-sm-16">
						<input id="lastlogintime" type="text" name="user.LASTLOGINTIME" value="#(user.lastlogintime??)" autocomplete="off" class='layui-input' readonly>
					</div>
				</div>
				<div class="layui-inline col-24 col-sm-24" style="margin-bottom: 15px;">
					<label class="layui-form-label col-6 col-sm-6">用户名</label>
					<div class="layui-input-inline col-18 col-sm-16">
						<input type="text" id="userName" name="user.USERNAME" value="#(user.userName??)" lay-verify="required|userName" 
							autocomplete="off" placeholder="请输入用户名" class='layui-input' readonly>
					</div>
				</div>
				<div class="layui-inline col-24 col-sm-24">
					<label class="layui-form-label col-6 col-sm-6">姓名</label>
					<div class="layui-input-inline col-18 col-sm-16">
						<input type="text" name="user.NAME" value="#(user.name??)" autocomplete="off" lay-verify="required" maxlength="20" placeholder="请输入姓名" class="layui-input">
					</div>
				</div>				
			</div>
			<div class="col-12 col-sm-24">
				<!-- <div class="layui-inline col-24 col-sm-24">
					<label class="layui-form-label col-6 col-sm-6" style="margin-top: 70px;">头像</label>
					<div class="layui-input-inline col-18 col-sm-16" style="padding-left: 20px;">
						<div class="site-demo-upload">
						  <img id="img_photo" src="#(detail.photo??'_common/img/userphoto.jpg')">
						  <div class="site-demo-upbar">
						    <input type="file" name="photo" class="layui-upload-file" id="photo">
						  </div>
						</div>
					</div>
				</div> -->
				
				
			<div class="layui-input-block">
	            <button type="button" class="layui-btn" id="upload1" name="photo">上传图片</button>
	            <input type="hidden" id="img_url"  name="detail.PHOTO" value="#(detail.photo??'_common/img/userphoto.jpg')"/>
	            <div class="layui-upload-list">
	                <!-- <img class="layui-upload-img" width="100px" height="80px" id="demo1"/> -->
	                <img class="layui-upload-img" width="100px" height="80px" id="img_photo" src="#(detail.photo??'_common/img/userphoto.jpg')">
	                <p id="demoText"></p>
	            </div>
	        </div>	
	        
	        
	        	
			</div>
		</div>
		
        
        
		<div class="layui-form-item">
			<div class="layui-inline col-12 col-sm-24">
				<label class="layui-form-label col-6 col-sm-6">性别</label>
				<div class="layui-input-inline col-18 col-sm-16">
					 <input type="radio" name="detail.SEX" value="1" title="男" #(detail.sex??=="1" ? "checked":"")>
				     <input type="radio" name="detail.SEX" value="0" title="女" #(detail.sex??=="0" ? "checked":"")>
				</div>
			</div>
			<div class="layui-inline col-12 col-sm-24">
				<label class="layui-form-label col-6 col-sm-6">身份证号</label>
				<div class="layui-input-inline col-18 col-sm-16">
					<input type="text" name="user.SFZMHM" value="#(user.sfzmhm??)" lay-verify="" autocomplete="off" maxlength="20" placeholder="请输入身份证号" class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline col-12 col-sm-24"> 
				<label class="layui-form-label col-6 col-sm-6">手机号</label>
				<div class="layui-input-inline col-18 col-sm-16">
					<input type="text" name="user.PHONE" value="#(user.phone??)" lay-verify="required" autocomplete="off" maxlength="20" placeholder="请输入手机号" class="layui-input">
				</div>
			</div>
			<div class="layui-inline col-12 col-sm-24">
				<label class="layui-form-label col-6 col-sm-6">邮箱</label>
				<div class="layui-input-inline col-18 col-sm-16">
					<input type="text" name="user.EMAIL" value="#(user.email??)" lay-verify="" autocomplete="off" maxlength="100" placeholder="请输入邮箱" class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline col-12 col-sm-24">
				<label class="layui-form-label col-6 col-sm-6">QQ</label>
				<div class="layui-input-inline col-18 col-sm-16">
					<input type="text" name="detail.QQ" value="#(detail.qq??)" lay-verify="" autocomplete="off" placeholder="请输入QQ号" maxlength="20" class="layui-input">
				</div>
			</div>
			<div class="layui-inline col-12 col-sm-24"> 
				<label class="layui-form-label col-6 col-sm-6">微信</label>
				<div class="layui-input-inline col-18 col-sm-16">
					<input type="text" name="detail.WEIXIN" value="#(detail.weixin??)" lay-verify="" autocomplete="off" placeholder="请输入微信号" maxlength="50" class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline col-24 col-sm-24">
				<label class="layui-form-label col-3 col-sm-6">地址</label>
				<div class="layui-input-inline col-21 col-sm-16">
					<input type="text" name="detail.ADDR" value="#(detail.addr??)" lay-verify="" autocomplete="off" placeholder="请输入地址" maxlength="200" class="layui-input">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div style="text-align: center;">
				<button class="layui-btn" lay-submit="" lay-filter="demo1">修改信息</button>
				<a href="xpUser/changePassword_ui?id=#(user.id)" class="layui-btn layui-btn-primary">修改密码</a>
			</div>
		</div>
	</div>
	
	
	 <!-- <script type="text/javascript" th:inline="javascript">
		
	layui.use(['form', 'laydate','element','upload'], function(){
		var form = layui.form
		,layer = layui.layer
		,laydate = layui.laydate;
		var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

	    layui.upload({
		    url: 'xpUser/uploadPhoto?userName=#(user.userName)' //上传接口
		    ,success: function(res){ //上传成功后的回调
		      	if(res.result)
		      	{
		      		if(res.result.msg)
		      			xpsoft.msg(res.result.msg);
		      		else
		      			$("#img_photo").attr("src",res.result.src+"?"+Math.random());
		      	}
		    }
		});
			
			
		  //监听提交
			form.on('submit(demo1)', function(data){
				//$("#photo").attr("disabled",true);
				//layer.alert(JSON.stringify(data.field), { title: '最终的提交信息' });
				//return false;
					
			});
		});
		$(function(){		
			#if(msg)
				xpsoft.msg('#(msg)');
			#end
		});			
		
	</script> -->
	
	
	<script type="text/javascript" th:inline="javascript">
	layui.use(['form', 'laydate','element','upload'], function(){
    	var form = layui.form
		,layer = layui.layer
		,laydate = layui.laydate;
		var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
        //var uploadInst = upload.render({
        layui.upload.render({
            elem: '#upload1' //绑定元素
            ,url: 'xpUser/uploadPhoto?userName=#(user.userName)' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#img_photo').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
            	//alert(JSON.stringify(res.result));
            	if(res.result.flag == 1){
            		layer.msg('上传成功');
            		//document.getElementById("img_url").value = res.result.src;
		      	}else if(res.result.flag == 0){
		      		layer.msg('上传失败');
		      	}
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
        
        //监听提交
		/* form.on('submit(demo1)', function(data){
			//$("#photo").attr("disabled",true);
			//layer.alert(JSON.stringify(data.field), { title: '最终的提交信息' });
			//return false;
				
		}); */
        
		//监听提交
		form.on('submit(demo1)', function(data){
			var url = $('#userForm').attr('action');
			$.post(url, data.field, function(res) {
				if (res.result == 1) {
					layer.msg(res.msg, {
						icon : 1,
						time : 1000
					}, function() {
						var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
						parent.layer.close(index); //再执行关闭  
						parent.reloadList();//重新reload列表
					});
				} else {
					layer.msg(res.msg, {
						icon : 5
					});
				}
			});
			return false;
		});
        
	});
	$(function(){		
		#if(msg)
			xpsoft.msg('#(msg)');
		#end
	});		
        
</script>
	
	<!-- <script type="text/javascript" th:inline="javascript">
    layui.use('upload', function(){
        var upload = layui.upload
            , $ = layui.jquery;
        var uploadInst = upload.render({
            elem: '#upload1' //绑定元素
            ,url: 'xpUser/uploadPhoto?userName=#(user.userName)' //上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#img_photo').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
            	//alert(JSON.stringify(res.result));
            	if(res.result.flag == 1){
            		layer.msg('上传成功');
            		document.getElementById("img_url").value = res.result.src;
            		//alert(res.result.msg);
		      		//if(res.result.msg)
		      			//xpsoft.msg(res.result.msg);
		      		//else
		      			//$("#img_photo").attr("src",res.result.src+"?"+Math.random());
		      	}else if(res.result.flag == 0){
		      		layer.msg('上传失败');
		      	}
               /*  //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
                //上传成功
                alert("上传成功"+res.url);
                document.getElementById("img_url").value = res.url; */

            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
    });
</script> -->
</fieldset>

	</form>
</div>
#end
